package com.wzxy.nc.util;

import java.util.Random;

public class KeyUtil {

    /**
     * 生成唯一的主键
     * 格式: 时间+三位随机数
     * @return
     */
    public static synchronized String genUniqueKey() {
        Random random = new Random();
        Integer number = random.nextInt(900) + 100;
        return System.currentTimeMillis() + String.valueOf(number);
    }
    
    public static synchronized String genUniqueKey(String prefix) {
    	return prefix + "-" + DateUtil.getStringAllDate() ;
    }
    
}
